﻿// Decompiled with JetBrains decompiler
// Type: DataTrace.App.Program
// Assembly: DataTrace.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 626B42CC-D912-405D-8BB1-A0EDDB371D86
// Assembly location: C:\Users\yudm\Desktop\DataTrace\sqlerpprofile\DataTrace.App.exe

using DataTrace.Config;
using FunUnitTest.CaseLog;
using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;

namespace DataTrace.App
{
    internal static class Program
    {
        [STAThread]
        private static void Main(string[] args)
        {
            //try
            //{
            //  ConfigHelper instance = ConfigHelper.GetInstance();
            //  ConfigHelper newInstance = ConfigHelper.GetNewInstance(instance.UpdatePath + ConfigHelper.ConfigName);
            //  if (args.Length == 1 && args[0] == "Updated")
            //  {
            //    instance.Version = newInstance.Version;
            //    instance.SaveConfig();
            //    int num = (int) MessageBox.Show("更新成功！\r\n当前版本：" + instance.Version);
            //  }
            //  else if (args.Length == 0)
            //  {
            //    Process currentProcess = Process.GetCurrentProcess();
            //    string fileName = currentProcess.MainModule.FileName;
            //    Process[] processesByName = Process.GetProcessesByName(currentProcess.ProcessName);
            //    bool flag = false;
            //    foreach (Process process in processesByName)
            //    {
            //      if ((process.MainModule.FileName == fileName || process.MainModule.FileName == ConfigHelper._dic + "UpdateApp.exe") && process.Id != currentProcess.Id)
            //      {
            //        flag = true;
            //        break;
            //      }
            //    }
            //    if (flag)
            //    {
            //      int num = (int) MessageBox.Show("程序已启动！");
            //      return;
            //    }
            //    if (string.Compare(newInstance.Version, instance.Version, true) > 0)
            //    {
            //      File.Copy(instance.UpdatePath + "\\DataTrace.Update.exe", ConfigHelper._dic + "DataTrace.Update.exe", true);
            //      if (!Directory.Exists(ConfigHelper._dic + "ConfigBak"))
            //        Directory.CreateDirectory(ConfigHelper._dic + "ConfigBak");
            //      File.Copy(ConfigHelper._dic + ConfigHelper.ConfigName, ConfigHelper._dic + "configbak\\config" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xml", true);
            //      new Process()
            //      {
            //        StartInfo = new ProcessStartInfo("DataTrace.Update.exe")
            //        {
            //          Arguments = ("\"" + currentProcess.ProcessName + "\"  \"" + currentProcess.Id.ToString() + "\" \"" + instance.UpdatePath + "\" \"" + (newInstance.IsConfigUpdate ? "1" : "0") + "\"")
            //        }
            //      }.Start();
            //      return;
            //    }
            //  }
            //}
            //catch (Exception ex)
            //{
            //  LogHelper.Log(ex);
            //}
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run((Form)new MainForm());
        }
    }
}
